package com.bw.emp.controller;

import com.bw.emp.domain.Emp;
import com.bw.emp.domain.Zzt;
import com.bw.emp.service.EmpService;
import org.spring.kun.common.ExcelUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    private EmpService empService;

    @RequestMapping("/list")
    public List<Zzt> empzhu(){
        List<Zzt> list = empService.listall();
        return list;
    }
    @RequestMapping("/export")
    public void export(HttpServletResponse response){
        List<Emp> list = empService.list();
        ExcelUtils.exportExcel(list,"你好","sheet1",response);
    }
}
